package work.mediway.mdm.core.entity;

import com.fasterxml.jackson.annotation.JsonInclude;

import java.util.List;

import javax.validation.constraints.NotBlank;

import cn.hutool.core.collection.CollUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * 字段信息
 *
 * @author zhongyj <1126834403@qq.com><br/>
 * @date 2022/6/17
 */
@ApiModel("indexInfo")
@Data
public class IndexInfo {
    /**
     * 表名
     */
    @NotBlank(message = "不能为空")
    @ApiModelProperty(value = "表名", required = true)
    private String tableName;
    /**
     * 索引名称
     */
    @ApiModelProperty(value = "索引名称")
    private String indexName;

    /**
     * 列名称
     */
    @ApiModelProperty(value = "列名称", hidden = true)
    private String columnName;

    @ApiModelProperty(value = "列名称")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private List<String> columnNames = CollUtil.newArrayList();

    @Data
    @ApiModel
    public static class IndexInfoDTO {

        @NotBlank(message = "不能为空")
        @ApiModelProperty(value = "表名", required = true)
        private String tableName;

        @ApiModelProperty(value = "索引名称", required = true)
        private List<String> indexNames;
    }

}
